Skip to content

Comments

feat: add rate limit & reduce max batch size#464

Merged
kbizikav merged 7 commits intodevfrom
rate-limit
Oct 30, 2025
Merged

feat: add rate limit & reduce max batch size#464
kbizikav merged 7 commits intodevfrom
rate-limit

Conversation

@kbizikav
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings October 20, 2025 17:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces client-side rate limiting and reduces maximum batch sizes to prevent overwhelming external APIs. The changes implement a token bucket rate limiter with configurable RPS and burst capacity, while decreasing batch size limits to reduce load on validity prover and store vault servers.

Key changes:

  • Reduced MAX_BATCH_SIZE from 128 to 32 for validity prover and from 256 to 64 for store vault server
  • Added RequestRateLimiter with cross-platform support (native and WASM)
  • Integrated rate limiting into ValidityProverClient, StoreVaultServerClient, and S3StoreVaultClient

Reviewed Changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
interfaces/src/api/validity_prover/interface.rs Reduced MAX_BATCH_SIZE constant from 128 to 32
interfaces/src/api/store_vault_server/interface.rs Reduced MAX_BATCH_SIZE constant from 256 to 64
client-sdk/src/external_api/validity_prover.rs Added rate limiting to ValidityProverClient with helper methods for rate-limited requests
client-sdk/src/external_api/utils/rate_limit.rs Implemented token bucket rate limiter with WASM and native support
client-sdk/src/external_api/utils/mod.rs Exported rate_limit module
client-sdk/src/external_api/store_vault_server.rs Integrated rate limiting into StoreVaultServerClient
client-sdk/src/external_api/s3_store_vault.rs Integrated rate limiting into S3StoreVaultClient
client-sdk/Cargo.toml Added instant dependency for WASM time support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@kbizikav kbizikav merged commit 0d4cb3c into dev Oct 30, 2025
5 checks passed
@kbizikav kbizikav deleted the rate-limit branch October 30, 2025 03:22
signature18632 added a commit that referenced this pull request Oct 31, 2025
* feat: Integrated gnark (#448)

* chore: update intmax2-zkp deps

* feat: delete circuit dependency

* feat: add some data

* docs: update readme & testdata

* chore: update proof

* chore: fix limb error

* Single history status (#453)

* feat: entry status replace

* feat: wip strategy replacement

* feat: impl seperate group

* feat: optional cursor

* feat: impl fetch batch

* feat: impl fetch batch wasm

---------

Co-authored-by: kbizikav <132550763+kbizikav@users.noreply.github.com>

* change os (#458)

* feat: add get used memo func for wasm (#469)

* feat: add get used memo func for wasm

* fix: fix typo for ci

* docs: added comprehensive docs for all nodes (#446)

* chore: update docs

* docs: add block builder docs

* docs: add balance prover readme

* docs: client sdk

* docs: fix client sdk docs

* docs: add validity prover docs

* docs: add block builder data structure

* docs: update block builder

* docs: add withdrawal server docs

* docs: add validity prover worker tasks

* docs: delete legacy store vault server

* docs: add pruning docs

* docs: update validity prover docs

* docs: update

* docs: interface

* docs: add Troubleshooting

* fix: add membership verification during `add_signature` (#465)

* fix: add membership verification during add_signature to prevent future panic

* Update block-builder/src/app/storage/memory_storage.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update block-builder/src/app/storage/memory_storage.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: typo for ci

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: add rate limit & reduce max batch size (#464)

* feat: add rate limit & reduce max batch size

* feat: use wasm time

* feat: longer rate limit

* feat: remove AGENTS.md

* fix: typo

* Retry 502 error (#470)

---------

Co-authored-by: Baby Bear <132609968+smallbabybear@users.noreply.github.com>

---------

Co-authored-by: kbizikav <132550763+kbizikav@users.noreply.github.com>
Co-authored-by: signature18632 <intmax18@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
signature18632 added a commit that referenced this pull request Nov 13, 2025
* feat: Integrated gnark (#448)

* chore: update intmax2-zkp deps

* feat: delete circuit dependency

* feat: add some data

* docs: update readme & testdata

* chore: update proof

* chore: fix limb error

* Single history status (#453)

* feat: entry status replace

* feat: wip strategy replacement

* feat: impl seperate group

* feat: optional cursor

* feat: impl fetch batch

* feat: impl fetch batch wasm

---------

Co-authored-by: kbizikav <132550763+kbizikav@users.noreply.github.com>

* change os (#458)

* feat: add get used memo func for wasm (#469)

* feat: add get used memo func for wasm

* fix: fix typo for ci

* docs: added comprehensive docs for all nodes (#446)

* chore: update docs

* docs: add block builder docs

* docs: add balance prover readme

* docs: client sdk

* docs: fix client sdk docs

* docs: add validity prover docs

* docs: add block builder data structure

* docs: update block builder

* docs: add withdrawal server docs

* docs: add validity prover worker tasks

* docs: delete legacy store vault server

* docs: add pruning docs

* docs: update validity prover docs

* docs: update

* docs: interface

* docs: add Troubleshooting

* fix: add membership verification during `add_signature` (#465)

* fix: add membership verification during add_signature to prevent future panic

* Update block-builder/src/app/storage/memory_storage.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update block-builder/src/app/storage/memory_storage.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: typo for ci

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: add rate limit & reduce max batch size (#464)

* feat: add rate limit & reduce max batch size

* feat: use wasm time

* feat: longer rate limit

* feat: remove AGENTS.md

* fix: typo

* Retry 502 error (#470)

---------

Co-authored-by: Baby Bear <132609968+smallbabybear@users.noreply.github.com>

* fix(client): consume only invalid (#473)

---------

Co-authored-by: kbizikav <132550763+kbizikav@users.noreply.github.com>
Co-authored-by: signature18632 <intmax18@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants